package com.ruoyi.project.paea.paeaDsTeller.service.impl;

import java.sql.Date;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.project.bms.bmsVoucherAssociate.domain.BmsVoucherModel;
import com.ruoyi.project.system.user.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.paea.paeaDsTeller.mapper.PaeaDsTellerMapper;
import com.ruoyi.project.paea.paeaDsTeller.domain.PaeaDsTeller;
import com.ruoyi.project.paea.paeaDsTeller.service.IPaeaDsTellerService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 日柜员Service业务层处理
 *
 * @author ruoyi
 * @date 2020-03-27
 */
@Service
public class PaeaDsTellerServiceImpl extends ServiceImpl<PaeaDsTellerMapper, PaeaDsTeller> implements IPaeaDsTellerService
{
    @Autowired
    private PaeaDsTellerMapper paeaDsTellerMapper;

    /**
     * 查询日柜员
     *
     * @param id 日柜员ID
     * @return 日柜员
     */
    @Override
    public PaeaDsTeller selectPaeaDsTellerById(String id)
    {
        return paeaDsTellerMapper.selectPaeaDsTellerById(id);
    }

    /**
     * 查询日柜员列表
     *
     * @param paeaDsTeller 日柜员
     * @return 日柜员
     */
    @Override
    public List<PaeaDsTeller> selectPaeaDsTellerList(PaeaDsTeller paeaDsTeller)
    {
        return paeaDsTellerMapper.selectPaeaDsTellerList(paeaDsTeller);
    }

    /**
     * 新增日柜员
     *
     * @param paeaDsTeller 日柜员
     * @return 结果
     */
    @Override
    public int insertPaeaDsTeller(PaeaDsTeller paeaDsTeller)
    {
        return paeaDsTellerMapper.insertPaeaDsTeller(paeaDsTeller);
    }

    /**
     * 修改日柜员
     *
     * @param paeaDsTeller 日柜员
     * @return 结果
     */
    @Override
    public int updatePaeaDsTeller(PaeaDsTeller paeaDsTeller)
    {
        return paeaDsTellerMapper.updatePaeaDsTeller(paeaDsTeller);
    }

    /**
     * 删除日柜员对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deletePaeaDsTellerByIds(String ids)
    {
        return paeaDsTellerMapper.deletePaeaDsTellerByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除日柜员信息
     *
     * @param id 日柜员ID
     * @return 结果
     */
    @Override
    public int deletePaeaDsTellerById(String id)
    {
        return paeaDsTellerMapper.deletePaeaDsTellerById(id);
    }


    /**
     * 根据当前登录人机构和日期查询
     *
     * @param user, @param paeaDsTeller
     * @return 结果
     */
    @Override
    public List<PaeaDsTeller> listNotBms(User user, PaeaDsTeller paeaDsTeller) {
        PaeaDsTeller data = new PaeaDsTeller();
        data.setTrDate(paeaDsTeller.getTrDate());
        data.setOrgCode(user.getDeptId());
        //System.out.println(data.getTrDate().toString()+"--------------"+data.getOrgCode());
        //BmsVoucherModel bmsVoucherModel = new BmsVoucherModel();
        //bmsVoucherModel.setOrgCode(user.getDeptId());
        //System.out.println(user.getDeptId());
        //bmsVoucherModel.setTrDate(paeaDsTeller.getTrDate());
        return paeaDsTellerMapper.findNotBms(data);
    }

    @Override
    public List<PaeaDsTeller> listBms(User user, PaeaDsTeller paeaDsTeller) {
        PaeaDsTeller data = new PaeaDsTeller();
        data.setTrDate(paeaDsTeller.getTrDate());
        data.setOrgCode(user.getDeptId());
        return paeaDsTellerMapper.findBms(data);
    }
}
